package com.ruoyi.common.utils;

import com.ruoyi.common.utils.token.AccToken;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;

import javax.servlet.http.HttpServletRequest;

/**
 * @author shaox
 * @date 2023/4/7
 * @apiNote
 */
public class ShaoxUtil {



    public static String getUserDtoName( ){
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = requestAttributes.getRequest();
        String userName = request.getHeader("userName");
        System.out.println(userName);
        return userName;
    }
    public static Long getUserDtoId( ){
        ServletRequestAttributes requestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
        HttpServletRequest request = requestAttributes.getRequest();
        String userId = request.getHeader("userId");
        Long uid = Long.valueOf(userId);
        System.out.println(uid);
        return uid;
    }

}
